<?php

/**
 * ContactoEmpresa form base class.
 *
 * @method ContactoEmpresa getObject() Returns the current form's model object
 *
 * @package    blackDrums
 * @subpackage form
 * @author     your name here
 */
abstract class BaseContactoEmpresaForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'cedula'            => new sfWidgetFormInputHidden(),
      'nombre'            => new sfWidgetFormInputText(),
      'apellido'          => new sfWidgetFormInputText(),
      'email'             => new sfWidgetFormInputText(),
      'idClienteJuridico' => new sfWidgetFormPropelChoice(array('model' => 'ClienteJuridico', 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'cedula'            => new sfValidatorPropelChoice(array('model' => 'ContactoEmpresa', 'column' => 'cedula', 'required' => false)),
      'nombre'            => new sfValidatorString(array('max_length' => 30)),
      'apellido'          => new sfValidatorString(array('max_length' => 35)),
      'email'             => new sfValidatorString(array('max_length' => 40)),
      'idClienteJuridico' => new sfValidatorPropelChoice(array('model' => 'ClienteJuridico', 'column' => 'rif')),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'ContactoEmpresa', 'column' => array('email')))
    );

    $this->widgetSchema->setNameFormat('contacto_empresa[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'ContactoEmpresa';
  }


}
